#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QVBoxLayout>

#include "serialportform.h"
#include "tcpserverform.h"
#include "tcpclientform.h"
#include "udpclientform.h"

#include <QTimer>


QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public:
    enum class enActive{
        enAcSerial,
        enAcTcpClient,
        enAcTcpServer,
        enAcUdp
    };
    Q_ENUM(enActive)


protected:
    void clearLayout();

    void on_comboBox_currentTextChanged(const QString &arg1);

private slots:
    void slot_pushButton_clicked();
    void slot_textEdit_receive(const QByteArray& data);
    void slot_checkbox_timer_send(int value);

    void slot_extra_information(const QString&);

private:
    Ui::MainWindow *ui;

    bool isCheckEnter;
    bool isCheckLineBreak;
    bool isTimeSpan;
    bool isTimeSend;
    bool isHexSend;
    bool isHexView;
    int m_timeInterval;

    stParameter m_param;

    enActive m_enActive;

    SerialPortForm *m_serial;
    TcpServerForm  *m_tcpServer;
    TcpClientForm  *m_tcpClient;
    UdpClientForm  *m_udp;

    QVBoxLayout* m_layout;

    QTimer* m_timer;
};
#endif // MAINWINDOW_H
